package com.beimin.evedata.model.ram;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import com.beimin.evedata.model.inv.InvType;

@Embeddable
public class RamTypeRequirementID implements Serializable {
	@ManyToOne
	@JoinColumn(name="TypeId")
	private InvType type;
	@ManyToOne
	@JoinColumn(name="requiredTypeId")
	private InvType requiredType;
	@ManyToOne
	@JoinColumn(name="activityID")
	private RamActivity activity;

  public InvType getType() {
    return type;
  }

  public void setType(InvType type) {
    this.type = type;
  }

  public RamActivity getActivity() {
    return activity;
  }

  public void setActivity(RamActivity activity) {
    this.activity = activity;
  }

	public InvType getRequiredType() {
		return requiredType;
	}

	public void setRequiredType(InvType requiredType) {
		this.requiredType = requiredType;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof RamTypeRequirementID) {
			return ((RamTypeRequirementID) obj).hashCode() == this.hashCode();
		}
		return false;
	}

	@Override
	public int hashCode() {
		return (type.getTypeID() + "" + activity.getActivityID() + "" + requiredType.getTypeID()).hashCode();
	}
}